from sqlalchemy import Column, String, Integer, DateTime, ForeignKey
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import relationship

from app.db.base_class import Base
from app.models.personalized_vocabulary import PersonalizedVocabulary
from .archivable import Archivable

# 个性化词库分类库模型
class PersonalizedWordLibrary(Base, Archivable):

    __tablename__ = 'personalized_word_library'
    # 分类名称
    category_name = Column("category_name", String)
    # category_name = Column(String, unique=True, nullable=True, comment="分类名称")
    # 使用次数
    usage_count = Column("usage_count", Integer, default=0)
    # 用户id
    user_id = Column(UUID(as_uuid=True), ForeignKey("user.id"))
    # 与个性化词库模型的关系
    # vocabularies = relationship("PersonalizedVocabulary", back_populates="category")
